package cn.tedu._04mybatis.mapper;

import cn.tedu._04mybatis.pojo.entity.Comment;
import cn.tedu._04mybatis.pojo.vo.CommentVO1;
import cn.tedu._04mybatis.pojo.vo.CommentVO2;
import cn.tedu._04mybatis.pojo.vo.ResultMapVo2;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CommentMapper {
//    @Insert("INSERT INTO comment(content,created,user_id,weibo_id) VALUES (#{content},#{created},#{userId},#{weiboId})")
    int insert(Comment comment);
//    @Delete("DELETE FROM comment WHERE id=#{uid}")
    int delete(Long uid);
//    @Select("SELECT content,user_id userId,weibo_id weiboId FROM comment WHERE id=#{uid}")
    CommentVO1 select(Long uid);
//    @Select("SELECT content,user_id userId FROM comment WHERE weibo_id=#{weiboId}")
    List<CommentVO2> selectByweiboId(Long weiboId);

    //ResulMap小练习
    ResultMapVo2 selectComment(Long id);
}
